#include <iostream>
#include <algorithm>

using namespace std;

long long dp[128][128] = {};
int a[128] = {};

void fun(int i, int j)
{
    if (dp[i][j])
    {
        return;
    }

    if (i == 1)
    {
        if (j > a[i])
            dp[i][j] = 0;
        else
            dp[i][j] = 1;
        return;
    }
    
    int sum = 0;
    for (int k = 0; k <= j && k <= a[i]; k++)
    {
        fun(i - 1, j - k);
        sum += dp[i - 1][j - k] % 1000007;
        sum %= 1000007;
    }
    // cout << i << " " << j << " " << a[i] << " " << sum << endl;
    dp[i][j] = sum;
}

int main(int argc, char const *argv[])
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    fun(n, m);
    cout << dp[n][m];
    return 0;
}
